package com.jn.mvvm2.views;

import android.os.Bundle;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.bumptech.glide.Glide;
import com.jn.mvvm2.R;
import com.jn.mvvm2.databinding.ActivityPetDetailBinding;
import com.jn.mvvm2.entity.Pet;

// PetDetailActivity.java
public class PetDetailActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActivityPetDetailBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pet_detail);
        Pet.PetDetails pet = (Pet.PetDetails) getIntent().getSerializableExtra("pet");
        binding.setPet(pet);

        ImageView petCoverImageView = binding.petCoverImageView;
        Glide.with(this)
                .load(pet.getCoverURL())
                .placeholder(R.drawable.img)
                .error(R.drawable.img)
                .into(petCoverImageView);
    }
}
